

'''
    统计一个类共有多少对象
    要在一个类中添加实例属性和类属性
    并且在添加实例的情况下类属性+1
'''

class Student(object):
    count = 0
    def __init__(self,name):
        self.__name = name
        Student.count+=1
        # 这里表示加1的是类属性的count，如果是self.count 则name.count=1


# 验证
John = Student('John')
print(Student.count)
Jesse = Student('Jesse')
print(Student.count)
Peter = Student('Peter')
print(Student.count)
Aybe = Student('Aybe')
print(Student.count)
